<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
//前端所有路由单独放在pc.php 和 mobile.php当中
require 'pc.php';
//require 'mobile.php';


/*
Route::group(['middleware' => 'throttle:30,1'], function () {
    Route::get('/index','IndexController@index');
});*/

//Route::resource('home', 'HomeController');


Route::group(['prefix' => 'admin'], function () {
    //微信
    Route::group(['namespace'=>'Admin'],function (){
        Route::any('wechat', 'WechatController@serve');
    });


    //Auth::routes();//只保留login logout其他不要
    Route::group(['namespace'=>'Auth'],function (){
        Route::get('login','LoginController@showLoginForm')->name('login');
        Route::post('login','LoginController@login');
        Route::post('logout','LoginController@logout')->name('logout');
    });

    Route::group(['middleware' => ['auth','menu','authAdmin']],function(){
        //权限模块
        Route::group(['namespace' => 'Admin'], function () {
            //后台首页已经在中间件处理过了
            //Route::get('/', 'HomeController@index');
            Route::get('index', 'IndexController@index')->name('index');

            Route::group(['prefix' => 'auth', 'as' => 'auth.'], function () {
                //管理员
                Route::get('admin_list', 'AuthController@admin_list')->name('admin_list');
                Route::get('admin_create', 'AuthController@admin_create')->name('admin_create');
                Route::post('admin_store', 'AuthController@admin_store')->name('admin_store');
                Route::get('admin_edit/{id}', 'AuthController@admin_edit')->name('admin_edit');
                Route::put('admin_update/{id}', 'AuthController@admin_update')->name('admin_update');
                Route::delete('admin_destroy/{id}', 'AuthController@admin_destroy')->name('admin_destroy');
                //角色
                Route::get('role_list', 'AuthController@role_list')->name('role_list');
                Route::get('role_create', 'AuthController@role_create')->name('role_create');
                Route::post('role_store', 'AuthController@role_store')->name('role_store');
                Route::get('role_edit/{id}', 'AuthController@role_edit')->name('role_edit');
                Route::put('role_update/{id}', 'AuthController@role_update')->name('role_update');
                Route::delete('role_destroy/{id}', 'AuthController@role_destroy')->name('role_destroy');
                //权限
                Route::get('permission_list', 'AuthController@permission_list')->name('permission_list');
                Route::get('permission_create', 'AuthController@permission_create')->name('permission_create');
                Route::post('permission_store', 'AuthController@permission_store')->name('permission_store');
                Route::get('permission_edit/{id}', 'AuthController@permission_edit')->name('permission_edit');
                Route::put('permission_update/{id}', 'AuthController@permission_update')->name('permission_update');
                Route::delete('permission_destroy/{id}', 'AuthController@permission_destroy')->name('permission_destroy');
                //清除缓存
                Route::get('clear_cache', 'AuthController@clear_cache')->name('clear_cache');
            });

            //后台管理员操作纪录
            Route::group(['prefix' => 'action','as' => 'action.'],function (){
                Route::get('index', 'ActionLogController@index')->name('index');
                Route::delete('destroy/{id}', 'ActionLogController@destroy')->name('destroy');
            });

            //快速通道申请纪录
            Route::group(['prefix' => 'fastApply','as' => 'fastApply.'],function (){
                Route::get('index', 'FastRecordController@index')->name('index');
                Route::post('index', 'FastRecordController@index')->name('index');
                Route::post('exportExcel', 'FastRecordController@exportExcel')->name('exportExcel');
                Route::get('delete/{id}', 'FastRecordController@delete')->name('delete');
                Route::delete('destroy/{id}', 'FastRecordController@destroy')->name('destroy');
            });
            //详细申请纪录
            Route::group(['prefix' => 'detailApply','as' => 'detailApply.'],function (){
                Route::get('index', 'DetailRecordController@index')->name('index');
                Route::post('index', 'DetailRecordController@index')->name('index');
                Route::post('exportExcel', 'DetailRecordController@exportExcel')->name('exportExcel');
                Route::get('delete/{id}', 'DetailRecordController@delete')->name('delete');
                Route::delete('destroy/{id}', 'DetailRecordController@destroy')->name('destroy');
            });
            //信用卡申请纪录
            Route::group(['prefix' => 'cardApply','as' => 'cardApply.'],function (){
                Route::get('index', 'CardRecordController@index')->name('index');
                Route::post('index', 'CardRecordController@index')->name('index');
            });
            //贷款申请纪录
            Route::group(['prefix' => 'originRecord','as' => 'originRecord.'],function (){
                Route::get('index', 'OriginRecordController@index')->name('index');
                Route::post('index', 'OriginRecordController@index')->name('index');
            });
            //头条申请纪录
            Route::group(['prefix' => 'toutiaoApply','as' => 'toutiaoApply.'],function (){
                Route::get('index', 'ToutiaoRecordController@index')->name('index');
                Route::post('index', 'ToutiaoRecordController@index')->name('index');
            });
        });

        //系统模块
        Route::group(['namespace' => 'System'], function () {
            Route::group(['prefix' => 'system', 'as' => 'system.'], function () {
                Route::get('index', 'HomeController@index')->name('index');
                Route::get('create', 'HomeController@create')->name('create');
            });
        });

    });
});




